<?php
if(isset($_POST["submit"]) == '')
{
	$content->setid($_GET["id"]);
	$detail = $content->getone();
?>

<div id="content_wrapper">
<div id="main_content" class="cf">
<form action="" class="formEl" id="form_a" method="post" enctype="multipart/form-data">
<div class="cf sepH_c">
<div id="content_actions" class="fr">
<button class="fr next btn btn_d submitForm" name="submit" type="submit" value="Submit">Sửa</button>
<a href="javascript:void(0)" class="clear_form btn btn_a">Clear form</a>
<a href="javascript:history.go(-1)" class="btn btn_a">Cancel</a></div>

</div>



<div class="msg_box msg_error" id="form_a_errors" style="display: none"></div>

<div class="content_panes">


<div class="formEl_a">

<fieldset><legend>Thông tin <?=$detail["title"]?></legend>
    <div class="sepH_b"><label for="title" class="lbl_a">Tiêu đề</label> 
    <input	type="hidden" name="location" value="<?=$detail["location"]?>" />
        <input	type="text" id="title" name="title" class="inpt_a" value="<?=$detail["title"]?>" />
    </div>

	<div class="sepH_c cf"><label for="text" class="lbl_a">Nội dung</label>
	<textarea name="content" id="content" cols="30" rows="10" class="tinymce txtar_a"><?=$detail["content"]?></textarea></div>
	
</fieldset>
</div>

</div>
</div>

</div>

</div>
</form>
</div>
</div>
<?php
} else {
	$content->setid($_GET["id"]);
	$content->settitle($_POST["title"]);
	$content->setcontent($_POST["content"]);
	$msg = $content->update();
	$main->redirect("index.php?m=".$_GET["m"]."&location=".$_POST["location"]);
}
?>
<link rel="stylesheet" href="lib/elfinder/css/elfinder.full.css"
	type="text/css" />
<link rel="stylesheet" href="lib/fancybox/jquery.fancybox-1.3.4.css"
	type="text/css" />
<link rel="stylesheet" href="lib/file-uploader/fileuploader.css"
	type="text/css" />

<script type="text/javascript">
		head.js(
			"js/jquery-1.6.2.min.js",
			"lib/jquery-ui/jquery-ui-1.8.15.custom.min.js",
			"lib/harvesthq-chosen/chosen.jquery.min.js",
			"lib/fusion-charts/FusionCharts.js",
			"lib/fancybox/jquery.easing-1.3.pack.js",
			"lib/fancybox/jquery.fancybox-1.3.4.pack.js",
			"lib/tiny-mce/jquery.tinymce.js",
			"js/jquery.microaccordion.js",
			"js/jquery.tools.min.js",
			"js/jquery.stickyPanel.js",
			"js/xbreadcrumbs.js",
			"lib/jquery-validation/jquery.validate.js",
			"js/lagu.js",
			function(){
				lga_fusionCharts.chart_k();
				lga_flowTabs.tabs_b();
				lga_selectBox.init();
				lga_datepicker.init();
				lga_editor.init();
				lga_sticky.sticky_contentActions();
				lga_clearForm.init();			
				lga_form_a_validation.init();
			}
		)
    </script>
